<template>
	<view id="app" v-cloak>
		<view style="overflow:auto;">
			<view style="height:25px;background:rgb(255,231,167);" v-if="isShow">
				<view style="width:90%;margin:0 auto;line-height:25px;color:rgb(195,166,98);font-size:12px;">
					{{doctor.msg}}
				</view>
			</view>
			<view style="height:122px;background:rgb(240 , 253 , 243);display:flex;">
				<view style="height:90px;width:70px;background:rgb(178,223,192);overflow:hidden;margin:20px 0 0 10px;">
					<view style="width:60px;height:80px;margin:5px;">
						<img :src="switchIcon(doctor.icon)" style="width:100%;height:100%;" />
					</view>
				</view>
				<view style="margin:22px 15px;">
					<view style="font-size:18px;font-weight:bold;">{{doctor.dName}}</view>
					<view style="font-size:12px;line-height:30px;color:grey;">{{doctor.tname}}&nbsp;&nbsp;&nbsp;&nbsp;{{doctor.zhiCheng.zname}}</view>
					<view style="font-size:12px;line-height:20px;color:grey;">职业编号：{{doctor.dBianHao}}</view>
				</view>
			</view>
			<view style="width:95%;height:60px;background:rgb(244,252,255);margin:10px auto;display:flex;overflow:hidden;">
				<view style="width:40px;height:40px;background:rgb(76,175,207);margin:10px;overflow:hidden;flex-shrink:0;">
					<view style="color:white;font-size:13px;margin:2px 5px;">个人介绍</view>
				</view>
				<view style="flex-grow:1;text-overflow:ellipsis;-webkit-line-clamp: 2;-webkit-box-orient: vertical;display:-webkit-box;font-size:13px;color:grey;height:40px;margin:10px 0;overflow:hidden;line-height:20px;">
					{{doctor.dDesc}}
				</view>
			</view>
			<view style="width:95%;height:180px;background:white;margin:0px auto;overflow:hidden;border:1px solid rgb(221,221,221);">
				<view style="height:59px;width:95%;margin:0 auto;border-bottom:1px dashed rgb(221,221,221);overflow:hidden;display:flex;">
					<view style="width:30px;height:40px;margin:10px 5px;">
						<view style="width:26px;height:40px;margin:0 auto;">
							<img src="../../static/center/renzheng.png" style="width:100%;height:100%;" />
						</view>
					</view>
					<view style="height:40px;margin:10px ;">
						<view style="font-size:15px;color:rgb(102,102,102);">职业资格医师认证</view>
						<view style="font-size:13px;color:rgb(187,187,187);">均持有医师证，官网可查真伪</view>
					</view>
				</view>
				<view style="height:59px;width:95%;margin:0 auto;border-bottom:1px dashed rgb(221,221,221);overflow:hidden;display:flex;">
					<view style="width:35px;height:40px;margin:10px 5px;">
						<view style="width:35px;height:40px;margin:0 auto;">
							<img src="../../static/center/fuwu.png" style="width:100%;height:100%;" />
						</view>
					</view>
					<view style="height:40px;margin:10px ;">
						<view style="font-size:15px;color:rgb(102,102,102);">100%真实医生服务</view>
						<view style="font-size:13px;color:rgb(187,187,187);">专家本人提供服务</view>
					</view>
				</view>
				<view style="height:60px;width:95%;margin:0 auto;overflow:hidden;display:flex;">
					<view style="width:30px;height:40px;margin:10px 5px;">
						<view style="width:30px;height:40px;margin:0 auto;">
							<img src="../../static/center/phone.png" style="width:100%;height:100%;" />
						</view>
					</view>
					<view style="height:40px;margin:10px ;" @click="dadianhua()">
						<view style="font-size:15px;color:rgb(102,102,102);">0734-15513679</view>
						<view style="font-size:13px;color:rgb(187,187,187);">服务热线</view>
					</view>
				</view>
			</view>
			<view style="width:95%;margin:10px auto;background:white;border:1px solid rgb(221,221,221);">
				<view style="height:40px;width:96%;margin:0px auto;border-bottom:1px solid rgb(221,221,221);line-height:40px;text-align:center;color:grey;font-size:15px;">
					患者印象
				</view>
				<view style="width:96%;margin:0 auto;display:flex;flex-wrap:wrap;">
					<view v-for="item in type" style="flex-shrink:0;padding:5px 10px;margin:5px;background:rgb(254,245,228);font-size:12px;color:rgb(234,126,27);">
						{{item.ctype.tname}}({{item.nums}})
					</view>
				</view>
			</view>
			<view v-for="item in doctor.pinglun" style="width:95%;margin:10px auto;background:white;">
				<view style="height:40px;width:95%;border-bottom:1px solid rgb(243,243,243);margin:0 auto;line-height:40px;font-size:13px;color:grey;">
					<view style="margin-left:3px;">
						综合评价：<span style="color:red;">{{item.ctype}}</span>
					</view>
				</view>
				<view style="width:95%;margin:0 auto;line-height:40px;font-size:14px;">
					<view style="margin-left:3px;">
						{{item.content}}
					</view>
				</view>
				<view style="width:95%;margin:0 auto;line-height:30px;font-size:12px;height:30px;text-align:right;color:grey;">
					{{item.time}}
				</view>
			</view>
			<view style="font-size:15px;color:grey;height:30px;line-height:30px;text-align:center;">
				已经到底了
			</view>
		</view>
		<!-- <view style="height:50px;background:white;box-shadow:0 -2px 5px 5px rgba(180 , 180 , 180 , 0.5);position:fixed;bottom:0px;left:0px;right:0px;">
			<view @click="create" style="height:100%;width:50%;background:rgb(112,194,68);color:white;float:right;line-height:50px;text-align:center;">立即向他咨询</view>
		</view> -->
		<view v-if="loading" style="position:fixed;z-index:9999;background:white;top:0px;left:0px;width:100%;height:100%;background:url('./images/empty.png');display:flex;align-items:center;display:hidden;display:flex;">
			<view style="width:80%;height:150px;margin:0 auto;background:white;border-radius:12px;">
				<view style="width:80px;height:80px;margin:5px auto;">
					<img src="../../static/center/loading.gif" style="width:100%;height:100%;" />
				</view>
				<view style="font-size:13px;line-height:20px;color:grey;text-align:center;">正在准备为您连接医生，请稍等</view>
				<view @click="cancel" style="height:50px;line-height:50px;text-align:center;color:blue;font-size:14px;">取消</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				did:'', //医生ID
				height:0 ,
				width:0 ,
				loading:false ,
				doctor:{},//医生信息
				me:{},
				type:[],
				isShow:false	//内容是否请求完成
			}
		},
		methods: {
			//初始化
			init(did){
				this.did = did
				//查询医生
				this.$http.get('/doctor.do',{
					p:'doctorinfo',
					id:did
				}).then(res => {
					this.doctor = res.data.data;
					//查询医生类型
					this.$http.get('/doctor.do',{
						p:'conmentGroup',
						id:did
					}).then(res => {
						this.type = res.data.data;
						this.isShow = true;
						// console.log("医生：",this.doctor)
						// console.log("类型：",this.type)
					})
				})
			},
			//取消连接医生
			cancel(){
				this.loading = false;
			},
			//返回医生图片
			switchIcon(icon){
				if(!this.isNull(icon) && icon.includes("http")){
					return icon
				}
				return this.host+icon;
			},
			//拨打服务热线
			dadianhua(){
				uni.makePhoneCall({
				    phoneNumber: "0734-15513679" //仅为示例
				});
			},
			//判空
			isNull(str){
				return str==null || str=="" || str==undefined
			},
			//点击咨询
			create(){
				this.loading = true;
				// setTimeout(() => {
				// 	this.$http.get('/doctor.do',{
				// 		p:'create',
				// 		dChannel:this.doctor.dChannel,
				// 		wChannel:uni.getStorageSync('openId')
				// 	}).then(res => {
				// 		if(res.data.code == 200){
							
				// 		}
				// 	})
				// },1000)
			}
		},
		onLoad(opt) {
			this.init(opt.did)
		}
	}
</script>

<style>
	*{margin:0px;padding:0px;}
	html,body{width:100%;height:100%;}
	#app{
		width:100%;height:100%;display:flex;flex-direction:column;overflow:hidden;background:rgb(245,245,245);
	}

	[v-cloak] {
		display: none !important;
	}
</style>
